Using Pictures
To create a picture, you should
-
use the
OpenCPicture
function to create a
Picture
record and begin defining the picture
-
issue QuickDraw drawing commands, which are collected in the
Picture
record
-
use the
PicComment
procedure to include picture comments in the picture definition (optional)
-
use the
ClosePicture
procedure to conclude the picture definition
To open an existing picture, you should
-
use File Manager routines to get a picture stored in a
'PICT'
file
-
use the
GetPicture
function to get a picture stored in a
'PICT'
resource
-
use the Scrap Manager function
GetScrap
to get a picture stored in the scrap
To draw a picture, you should use the
DrawPicture
procedure.
To save a picture, you should
-
use File Manager routines to save the picture in a
'PICT'
file
-
use Resource Manager routines to save the picture in a
'PICT'
resource
-
use the Scrap Manager function
PutScrap
to place the picture in the scrap
To conserve memory, you can spool large pictures to and from disk storage; you should
-
write your own low-level procedures--using File Manager routines--that read and write temporary
'PICT'
files to disk
-
use the
SetStdCProcs
procedure for a color graphics port (or the
SetStdProcs
procedure for a basic graphics port) and replace QuickDraw's standard low-level procedures
StdGetPic
and
StdPutPic
with your own procedures for reading and writing temporary
'PICT'
files to disk
To gather information about a single picture, pixel map, or bitmap, you should
-
use the
GetPictInfo
function to get information about a picture, or use the
GetPixMapInfo
function to get information about a pixel map or bitmap
-
use the
Palette
record or the
ColorTable
record, the handles of which are returned by these functions in a
PictInfo
record, to examine the colors collected from the picture, pixel map, or bitmap
-
use the
FontSpec
record, the handle of which is returned by
GetPictInfo
in a
PictInfo
record, to examine the fonts contained in the picture
-
use the
CommentSpec
record, the handle of which is returned by
GetPictInfo
in a
PictInfo
record, to examine the picture comments contained in the picture
-
examine the rest of the fields of the
PictInfo
record for additional information--such as pixel depth or optimal resolution--about the picture, pixel map, or bitmap
-
use the Memory Manager procedure
DisposeHandle
to release the memory occupied by the
PictInfo
,
FontSpec
, and
CommentSpec
records; use the Palette Manager procedure
DisposePalette
to release the memory occupied by a
Palette
record; and use the Color QuickDraw procedure
DisposeCTable
to release the memory occupied by a
ColorTable
record when you are finished with the information collected by the
GetPictInfo
function
To gather information about multiple pictures, pixel maps, and bitmaps, you should
-
use the
NewPictInfo
function to begin collecting pictures, pixel maps, and bitmaps for your survey
-
use the
RecordPictInfo
function to add the information for a picture to your survey
-
use the
RecordPixMapInfo
function to add the information for a pixel map or bitmap to your survey
-
use the
RetrievePictInfo
function to return the collected information in a
PictInfo
record
-
use the
Palette
record or the
ColorTable
record, the handles of which are returned in the
PictInfo
record, to examine the colors collected from the pictures, pixel maps, and bitmaps
-
use the
FontSpec
record, the handle of which is returned in the
PictInfo
record, to examine the fonts contained in the collected pictures
-
use the
CommentSpec
record, the handle of which is returned in the
PictInfo
record, to examine the picture comments contained in the collected pictures
-
examine the rest of the fields of the
PictInfo
record for additional information about the pictures, pixel maps, and bitmaps in your survey
-
use the
DisposePictInfo
function to dispose of the private data structures allocated by the
NewPictInfo
function; use the Memory Manager procedure
DisposeHandle
to release the memory occupied by
PictInfo
,
FontSpec
, and
CommentSpec
records; use the Palette Manager procedure
DisposePalette
to release the memory occupied by a
Palette
record; and use the Color QuickDraw procedure
DisposeCTable
to release the memory occupied by a
ColorTable
record when you are finished with the information collected by
NewPictInfo
When you are finished using a picture (such as when you close the window containing it), you should
-
release the memory it occupies by calling the
KillPicture
procedure if the picture is not stored in a
'PICT'
resource
-
release the memory it occupies by calling the Resource Manager procedure
ReleaseResource
if the picture is stored in a
'PICT'
resource
Before using the routines described in this chapter, you must use the
InitGraf
procedure, described in the chapter "Basic QuickDraw" in this book, to initialize QuickDraw. The routines in this chapter are available on all computers running System 7--including those supporting only basic QuickDraw. To test for the existence of System 7, use the
Gestalt
function with the
gestaltSystemVersion
selector. Test the low-order word in the
response
parameter; if the value is $0700 or greater, all of the routines in this chapter are supported.
On computers running only basic QuickDraw, the Picture Utilities return
NIL
in place of handles to
Palette
and
ColorTable
records.
© 1997 Apple Computer, Inc.Previous | Chapter Top | Chapter Contents | Next